<%@ taglib uri="/tags/struts-bean" prefix="bean"%>
<%@ taglib uri="/tags/struts-html" prefix="html"%>
<%@ taglib uri="/tags/struts-logic" prefix="logic"%>
<%@ taglib uri="/tags/core" prefix="c"%>
<%@ taglib uri="/tags/fmt" prefix="fmt"%>
<script type="text/javascript" src="js/utils.js"></script>
<script type="text/javascript">
		function submitForm(action){			
	    	var form = document.getElementById('mainForm');	    	
	    	form.action = action;
	    	form.submit();	    		    	   
		}
</script>

<html:form action="/pidNewSearchCustomerResult.do" styleId="mainForm">
<html:hidden property="ipdView.purchaseInstructionId" />
<br />
<table align="center" width="400" cellpadding="2" cellspacing="1" border="0" bgcolor="#CCCCC0">
	<tr>
		<td class="etiqueta">
			<bean:message key="message.futurepurchase.customer.search"/><br/>
		</td>
		<td colspan="2" style="text-align: left;" class="etiqueta_campo">			
			<html:text property="ipdView.customerViewSearch.description" styleId="customerViewSearch.description"  styleClass="campo_texto"/>			
			<html:submit value="..." styleClass="boton_short" />
		</td>
	
	</tr>
</table>	

<br />

<table id="tabla" align="center" width="400" cellpadding="2" cellspacing="1" border="0" bgcolor="#CCCCC0">
  <tr>
	<td colspan="3" class="titulocolumna" align="center"> <bean:message key="label.common.results"/> </td>
  </tr>  
  <tr>
  	<td class="etiqueta" align="center">&nbsp;&nbsp;</td>  	
  	<td class="columnadatoNon" align="center"> <bean:message key="message.futurepurchase.customer.code"/> </td>
  	<td class="columnadatoNon" align="center"> <bean:message key="error.description"/> </td>  	
  </tr>   
  <logic:notEmpty name="listOfCustomers">  	
		<logic:iterate id="row" name="listOfCustomers" indexId="int_i">
			<tr class="<%=((int_i.intValue()%2)==0?"columnadatoPar":"columnadatoNon")%>">																			
				<td align="center" width="30">	
					<bean:define id="numberValue"><bean:write name="row" property="customerId"/></bean:define> 											
					<html:radio styleId="radioId<%=int_i%>" property="ipdView.customerViewSearch.customerId" value="<%=numberValue%>" />
				</td>										
				<td align="center" width="90"><label for="radioId<%=int_i%>"><bean:write name="row" property="customerId"/></label></td>
				<td align="left" width="280"><label for="radioId<%=int_i%>"><bean:write name="row" property="description"/></label></td>
			</tr>
		</logic:iterate>
	</logic:notEmpty>
	<tr>
	<td colspan="3" align="center" class="columnadatoPar">		
		 <logic:notEmpty name="listOfCustomers">   
			<html:button styleId="selectButton" property="submitAction" onclick="javascript:submitForm('pidNewSelectCustomer.do')" styleClass="boton_large"><bean:message key="label.common.select"/></html:button>&nbsp;&nbsp;
		 </logic:notEmpty>
		 <logic:empty name="listOfCustomers">   
			<html:button styleId="selectButton" property="submitAction" disabled="true" onclick="javascript:submitForm('pidNewSelectCustomer.do')" styleClass="boton_large"><bean:message key="label.common.select"/></html:button>&nbsp;&nbsp;
		 </logic:empty>					
		<html:button styleClass="boton" property="backButton" onclick="location.href='purchaseInstructionDetailsNew.do';"> <bean:message key="label.common.cancel"/> </html:button>											
	</td>
	</tr>
</table>
</html:form>
<script>
document.getElementById('customerViewSearch.description').value = "";	  
</script>
<br />
<br />